<template>
  <el-container>
    <el-header height="72px">
      <HeaderPart></HeaderPart>
    </el-header>
    <el-container>
      <AsidePart></AsidePart>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import HeaderPart from "../components/HeaderPart.vue";
import AsidePart from "../components/AsidePart.vue";
export default {
  name: "HomePart",
  components: {
    HeaderPart,
    AsidePart,
  },
  mounted() {
    this.axios
      .post(
        "http://127.0.0.1:8080/Login/token",
        {},
        {
          headers: {
            "content-type": "application/x-www-form-urlencoded",
          },
          params: {
            Authorization: `bearer ${localStorage.getItem("token")}`,
          },
        }
      )
      .then((res) => {
        if(res.data.code != 200){
          this.$message.error("请先登录");
          this.$router.push('/login');
        }
      })
  },
};
</script>

<style>
</style>